<div class="real-contents max-contents">
	<div class="clearfix " style="display: block">
		<span class="rectangle left-min-margin"></span>
		<span class="title">修改账户密码</span>
	</div>
	<form action="/SmartClass/userAPI/editPassword" id="editPasswordForm" method="post">
		<ul class="input-ul ">
			<li class="input-li">
				<span class="input-title">
					旧密码
					<span style="color: red;">*</span>
					:
				</span>
				<span class="input-border">
					<input type="password" class="input-text" name="oldpassword" style="width: 200px;" id="password" placeholder="在此处填写旧密码" />
				</span>
				<span id="oldposswordeye" class="glyphicon glyphicon-eye-close"></span>
			</li>
			<li class="input-li">
				<span class="input-title">
					新密码
					<span style="color: red;">*</span>
					:
				</span>
				<span class="input-border">
					<input type="password" class="input-text" name="newpassword" style="width: 200px;" id="password" placeholder="在此处填写旧密码" />
				</span>
				<span id="newposswordeye" class="glyphicon glyphicon-eye-close"></span>
			</li>
		</ul>
	</form>
	<table class='show-table-appoint'>
		<tr class='show-tr'>
			<th style="color: red;" id="error_msg"></th>
		</tr>
	</table>
	<ul class="input-ul" style="margin-top: 30px;">
		<li class="input-li" style="margin-bottom: 0">
			<button class="page-margin input-border min-submit" id="edit">修改密码</button>
		</li>
	</ul>
</div>
<script type="text/javascript">
$(function(){
	//密码的显示隐藏
	$("#oldposswordeye").click(function(){
		if($(this).hasClass('glyphicon-eye-open')){
			$(this).removeClass('glyphicon-eye-open').addClass('glyphicon-eye-close');//密码可见
			$("[name='oldpassword']").prop('type','password');
		}else{
			$(this).removeClass('glyphicon-eye-close').addClass('glyphicon-eye-open');//密码不可见
			$("[name='oldpassword']").prop('type','text');
		};
	});
	$("#newposswordeye").click(function(){
		if($(this).hasClass('glyphicon-eye-open')){
			$(this).removeClass('glyphicon-eye-open').addClass('glyphicon-eye-close');//密码可见
			$("[name='newpassword']").prop('type','password');
		}else{
			$(this).removeClass('glyphicon-eye-close').addClass('glyphicon-eye-open');//密码不可见
			$("[name='newpassword']").prop('type','text');
		};
	});
	$(".min-submit").click(function(){
		if($('[name="newpassword"]').val()=="")
		{
			alert_text("warning","新密码不能为空");
			return;
		}
		var password = $('[name="newpassword"]').val();
		var len=password.length;
		//alert_text(len);
		if(len<8||len>16)
		{
			alert_text("warning","请设置8-16位的密码");
			$('[name="newpassword"]').val("");
			$('[name="newpassword"]').focus();
			return;
		}

		
		ajaxForm($('#editPasswordForm'),function(){
			alert("设置成功,请重新登录");
			window.location.href = '/SmartClass/login/logout';
			},function(res){
				$("#error_msg").text(res.msg);
				$(".show-table-appoint").show();
			});
	});
});
</script>